import { getQueryParams } from '@/utils';
import http from './http';

export default {
  /** 提现管理 */

  // 提现记录
  getWithDrawRecord(params) {
    return http
      .get(`/mall/web/agent/v1/account/current?${getQueryParams(params)}`)
      .exec();
  },

  // 提现记录审核
  reviewWithdraw(id) {
    return http.post('/mall/web/agent/v1/account/current/audit', id).exec();
  },

  /** 代理人管理 */

  // 代理人
  getAgentors(params) {
    return http
      .get(`/mall/web/agent/v1/agents?${getQueryParams(params)}`)
      .exec();
  },
  // 获取根代理二维码
  getRootQrCode() {
    return http.get('/mall/web/agent/v1/getqrcode').exec();
  },

  /** 佣金管理 */

  getCommission(params) {
    return http
      .get(`/mall/web/agent/v1/ratio/agent/query?${getQueryParams(params)}`)
      .exec();
  },
  saveCommission(params) {
    return http.post(`/mall/web/agent/v1/ratio/agent/set`, params).exec();
  },

  /** 代理人管理*/

  // 代理提成比例查询
  getRatioAgentList(params) {
    return http.get(`/mall/web/agent/v1/ratio/agent/query`, params).exec();
  },
  // 代理提成比例设置
  setRatioAgent(params) {
    return http.post(`/mall/web/agent/v1/ratio/agent/set`, params).exec();
  },

  // 领导奖比例查询
  getRatioLeadList(params) {
    return http.get(`/mall/web/agent/v1/ratio/lead/query`, params).exec();
  },
  // 领导奖比例设置
  setRatioLead(params) {
    return http.post(`/mall/web/agent/v1/ratio/lead/set`, params).exec();
  },

  /** 资金流水 */

  // 提现记录-分页查询
  getAccountList(params) {
    return http.get(`/mall/web/agent/v1/account/current`, params).exec();
  },
  // 提现记录-审核
  setAccountAudited(currentId) {
    return http
      .post(`/mall/web/agent/v1/account/current/audit`, currentId)
      .exec();
  },

  /** 代理费计算提取 */

  getProcessList(params) {
    return http.get(`/mall/web/agent/v1/process/list`, params).exec();
  },
  calcAgentProfit(params) {
    return http.post(`/mall/web/agent/v1/agentprofit/deal`, params).exec();
  },
  calcLeadProfit(params) {
    return http.post(`/mall/web/agent/v1/leadprofit/deal`, params).exec();
  },
  calcEnterProfit(params) {
    return http.post(`/mall/web/agent/v1/enterprofit/deal`, params).exec();
  },

  /** 代理销售收益情况查询 */

  getMonthProfitList(params) {
    return http.get(`/mall/web/agent/v1/monthprofit/list`, params).exec();
  },
};
